#pragma once
#include "../render/IRenderData.h"
POCELAIN_NAMESPACE_BEGIN
class IRenderer;
class RenderDataCacheHelper
{
    friend IRenderer;
protected:
    RenderDataCacheHelper(){}
    ~RenderDataCacheHelper()
    {
        // Clear render data
        setRenderData(nullptr);
    }
private:
    void setRenderData(IRenderData *data)
    {
        if(mRenderData != nullptr)
        {
            mRenderData -> release();
        }
        mRenderData = data;
        if(mRenderData!=nullptr)
        {
            mRenderData->retain();
        }
    }
    IRenderData *getRenderData()const
    {
        return mRenderData;
    }
    // Renderer customized renderData
    // Is different between renderers
    IRenderData *mRenderData = nullptr;
};
POCELAIN_NAMESPACE_END
